package com.harry12.mybatis.controller;

import com.harry12.mybatis.Mapper.TeacherMapper;
import com.harry12.mybatis.entity.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TeacherController {
    @Autowired
    TeacherMapper teacherMapper;
    @GetMapping("/getTeacher/{tid}")
    public String getTeacher(@PathVariable("tid") Integer tid){
        List<Teacher> list = teacherMapper.getTeacher(tid);
        for(Teacher t:list){
            System.out.println(t);
        }
      return  "yyy" ;
    }
    @GetMapping("/getTeacher2/{tid}")
    public String getTeacher2(@PathVariable("tid") Integer tid){
        List<Teacher> list = teacherMapper.getTeacher2(tid);
        for(Teacher t:list){
            System.out.println(t);
        }
        return  "yyy" ;
    }
}
